import Main from "../view/main/main";
import parentView from "@/components/parent-view";
import router from "@/router";
import store from "@/store";
/**
 * iview-admin中meta除了原生参数外可配置的参数:
 * meta: {
 *  hideInMenu: (false) 设为true后在左侧菜单不会显示该页面选项
 *  notCache: (false) 设为true后页面不会缓存
 *  access: (null) 可访问该页面的权限数组，当前路由设置的权限会影响子路由
 *  icon: (-) 该页面在左侧菜单、面包屑和标签导航处显示的图标，如果是自定义图标，需要在图标名称前加下划线'_'
 *  hideInNav:(false) 设为false，导航面包屑不会显示该菜单
 *  notTag: (false) 设为true后tag列不会显示
 * }
 */
let configRouter = [
  {
    path: "/",
    name: "login",
    meta: {
      title: "Login - 登录",
      hideInMenu: true
    },
    component: () => import(/*webpackChunkName: "login"*/"../view/login/login.vue")
  },
  {
    path: '/401',
    name: 'error_401',
    meta: {
      hideInMenu: true
    },
    component: () => import(/*webpackChunkName: "401"*/'@/view/error-page/401.vue')
  },
  {
    path: '/500',
    name: 'error_500',
    meta: {
      hideInMenu: true
    },
    component: () => import(/*webpackChunkName: "500"*/'@/view/error-page/500.vue')
  },
  {
    path: '*',
    name: 'error_404',
    meta: {
      hideInMenu: true
    },
    component: () => import(/*webpackChunkName: "404"*/'@/view/error-page/404.vue')
  },
  {
    path: "/home",
    name: "首页",
    meta: {
      title: "首页",
      hideInMenu: true,
      hideInNav: true,
      notTag:true,
      icon: "md-speedometer"
    },
    component: Main,
    children: [
      {
        path: "/home",
        name: "home",
        meta: {
          icon: "md-speedometer",
          title: "首页",
          hideInMenu: true,
          hideInNav: true,
          notTag:true,
        },
        component: () => import(/*webpackChunkName: "home"*/"../view/home/home.vue")
      }
    ]
  },
  {
    path: "/main",
    name: "结算统计",
    meta: {
      title: "结算统计",
      icon: "md-speedometer",
      access: ["admin","wash"]
    },
    component: Main,
    children: [
      {
        path: "/xd-settle",
        name: "xd-settle",
        meta: {
          icon: "md-speedometer",
          title: "结算统计"
        },
        component: () => import(/*webpackChunkName: "xd-settle"*/"@/view/xd-settle/xd-settle.vue")
      }
    ]
  },
  {
    path: "/xd-user-manage",
    name: "xd-user-manage",
    meta: {
      icon: "md-contact",
      title: "用户管理",
      access: ["admin"]
    },
    component: Main,
    children: [
      {
        path: "xd-hospital-role",
        name: "xd-hospital-role",
        meta: {
          icon: "arrow-graph-up-right",
          title: "医院账号管理"
        },
        component: () => import(/*webpackChunkName: "xd-hospital-role"*/"@/view/xd-user-manage/xd-hospital-role/xd-hospital-role.vue")
      },
      {
        path: "xd-washing-role",
        name: "xd-washing-role",
        meta: {
          icon: "arrow-graph-up-right",
          title: "洗涤账号管理"
        },
        component: () => import(/*webpackChunkName: "xd-washing-role"*/"@/view/xd-user-manage/xd-washing-role/xd-washing-role.vue")
      },
      {
        path: "xd-device",
        name: "xd-device",
        meta: {
          icon: "arrow-graph-up-right",
          title: "设备管理"
        },
        component: () => import(/*webpackChunkName: "xd-device"*/"@/view/xd-user-manage/xd-device/xd-device.vue")
      },
      {
        path: "xd-hospital-wash-bind",
        name: "xd-hospital-wash-bind",
        meta: {
          icon: "arrow-graph-up-right",
          title: "医洗绑定"
        },
        component: () => import(/*webpackChunkName: "xd-hospital-wash-bind"*/"@/view/xd-user-manage/xd-hospital-wash-bind/xd-hospital-wash-bind.vue")
      }
    ]
  },
  {
    path: "/xd-customer-management",
    name: "xd-customer-management",
    meta: {
      icon: "md-people",
      title: "合同管理",
      access: ["admin","wash"]
    },
    component: Main,
    children: [
      {
        path: "xd-contract",
        name: "xd-contract",
        meta: {
          icon: "md-people",
          title: "合同管理"
        },
        component: () => import(/*webpackChunkName: "xd-contract"*/"@/view/xd-customer-management/xd-contract/xd-contract.vue")
      }
    ]
  },
  {
    path: "/xd-wash-management",
    name: "xd-wash-management",
    meta: {
      icon: "md-water",
      title: "洗涤管理",
      access: ["admin","wash"]
    },
    component: Main,
    children: [
      {
        path: "xd-category",
        name: "xd-category",
        meta: {
          icon: "md-water",
          title: "价格类别"
        },
        component: () => import(/*webpackChunkName: "xd-category"*/"@/view/xd-wash-management/xd-category/xd-category.vue")
      }
    ]
  },
  {
    path: "/xd-label-management",
    name: "xd-label-management",
    meta: {
      icon: "md-pricetag",
      title: "标签管理",
      access: ["admin","wash"]
    },
    component: Main,
    children: [
      {
        path: "xd-label-overview",
        name: "xd-label-overview",
        meta: {
          icon: "arrow-graph-up-right",
          title: "标签总览"
        },
        component: () => import(/*webpackChunkName: "xd-label-overview"*/"@/view/xd-label-management/xd-label-overview/xd-label-overview.vue")
      },
      {
        path: "xd-label-search",
        name: "xd-label-search",
        meta: {
          icon: "arrow-graph-up-right",
          title: "标签查询"
        },
        component: () => import(/*webpackChunkName: "xd-label-search"*/"@/view/xd-label-management/xd-label-search/xd-label-search.vue")
      }
    ]
  },
  {
    path: "/xd-wash-count",
    name: "xd-wash-count",
    meta: {
      icon: "md-medal",
      title: "洗涤统计",
      access: ["admin","wash"]
    },
    component: Main,
    children: [
      {
        path: "xd-put-in",
        name: "xd-put-in",
        meta: {
          icon: "arrow-graph-up-right",
          title: "入库"
        },
        component: () => import(/*webpackChunkName: "xd-put-in"*/"@/view/xd-wash-count/xd-put-in/xd-put-in.vue")
      },
      {
        path: "xd-sort-out",
        name: "xd-sort-out",
        meta: {
          icon: "arrow-graph-up-right",
          title: "分拣"
        },
        component: () => import(/*webpackChunkName: "xd-sort-out"*/"@/view/xd-wash-count/xd-sort-out/xd-sort-out.vue")
      },
      {
        path: "xd-out-in",
        name: "xd-out-in",
        meta: {
          icon: "arrow-graph-up-right",
          title: "出库"
        },
        component: () => import(/*webpackChunkName: "xd-out-in"*/"@/view/xd-wash-count/xd-out-in/xd-out-in.vue")
      }
    ]
  },
  {
    path: "/xd-hospital-count",
    name: "xd-hospital-count",
    meta: {
      icon: "md-medkit",
      title: "医院统计",
      access: ["admin","wash","hospital"]
    },
    component: Main,
    children: [
      {
        path: "xd-y-put-in",
        name: "xd-y-put-in",
        meta: {
          icon: "arrow-graph-up-right",
          title: "入库"
        },
        component: () => import(/*webpackChunkName: "xd-y-put-in"*/"@/view/xd-hospital-count/xd-y-put-in/xd-y-put-in.vue")
      },
      {
        path: "xd-y-hand-out",
        name: "xd-y-hand-out",
        meta: {
          icon: "arrow-graph-up-right",
          title: "分发"
        },
        component: () => import(/*webpackChunkName: "xd-y-hand-out"*/"@/view/xd-hospital-count/xd-y-hand-out/xd-y-hand-out.vue")
      },
      {
        path: "xd-y-out-in",
        name: "xd-y-out-in",
        meta: {
          icon: "arrow-graph-up-right",
          title: "出库"
        },
        component: () => import(/*webpackChunkName: "xd-y-out-in"*/"@/view/xd-hospital-count/xd-y-out-in/xd-y-out-in.vue")
      }
    ]
  },
  
];

router.addRoutes(configRouter);

store.commit('setRouter',configRouter);

router.beforeEach((to, from, next) => {
  router.customBeforeEach(to, from, next, configRouter);
});

router.afterEach(to => {
  router.customAfterEach(to);
});

export default router;
